import { accRevise } from '@/api/account.api';

export const validateRevise = function (rule, value, callback) {
    if (!value) {
        return callback(new Error("请输入密码"));
    }
    accRevise(value).then(res => {
        if (res.data.code === 0) callback()
        else callback(new Error('旧密码错误'))
    })
};

export const validateRevise2 = function (rule, value, callback) {
    if (value == "") {
        callback(new Error("请再次输入密码！"));
    } else if (value !== this.pwd.newPwd) {
        callback(new Error("两次输入的密码不一致！"));
    } else {
        callback();
    }
};